<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>旋转案例</title>
    <style>
        .box {
            overflow: hidden;
            width: 200px;
            height: 200px;
            border: 1px solid #000;
            background-color: red;
            margin: 100px auto;
        }

        .box::before {
            content: '';
            display: block;
            width: 100%;
            height: 100%;
            background-color: blue;
            transform: rotate(180deg);
            transform-origin: left bottom;
            transition: all 1s;
        }

        /* 鼠标经过盒子旋转回来 */
        .box:hover::before {
            transform: rotate(0deg);
        }
    </style>
</head>

<body>
    <div class="box"></div>
</body>

</html>